package com.coolingme.domain;

import com.coolingme.annotation.MyAnnotation;

public class Person extends Father {

    // 构造方法
    @MyAnnotation({"wangyue","23"})
    public Person() {
        System.out.println("无参的构造方法");
    }

    public Person(String name) {
        this.name = name;
        System.out.println("只有一个参数的构造方法");
    }

    private Person(String name, Integer age) {
        this.name = name;
        this.age = age;
        System.out.println("有两个参数的构造方法");
    }


    // 参数
    @MyAnnotation("wangyue")
    public String name;

    private Integer age;

    // get/set
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    // 方法
    public void speak() {
        System.out.println("Hello World");
    }

    public Integer speak(Integer age) {
        try {
            System.out.println("我今年" + age + "岁了");
            return 1 / age;//没抓到异常
        } catch (ArithmeticException e) {
            e.printStackTrace();
        }
        return 2 ^ 5;
    }

    private String getWeight(Integer weight) {
        return "我的体重是：" + weight +"kg";
    }

    // 内部类
    public class Tom {

    }

    class Jory {

    }

    private class Dylan {

    }


    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
